package cn.good.yan;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
 * SpringBoot项目  - SpringSecurity仅做登录授权
 *
 *
 * @author shengren.yan
 * @create 2023-09-27
 */
@MapperScan("cn.good.yan.mapper")
@EnableDiscoveryClient
@SpringBootApplication
public class AuthApplication {

    public static void main(String[] args) {
        SpringApplication.run(AuthApplication.class, args);
    }

}

/**
 * 引出问题
 * Gateway跟Security好像有点不兼容！
 * 在引入Gateway的时候我们需要排除掉spring-boot-starter-web这个依赖，
 * 因为它们的一个是webflux，一个是mvc。
 * 需要这么配置 ：
 * @Configuration
 * @EnableGlobalMethodSecurity(prePostEnabled = true)
 * @EnableWebFluxSecurity
 * public class SecurityConfig {
 *
 *     @Bean
 *     public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity httpSecurity){
 *         httpSecurity
 *                 .authorizeExchange()
 *                 .pathMatchers("/**").permitAll()
 *                 .pathMatchers(HttpMethod.OPTIONS).permitAll()
 *                 .anyExchange().authenticated()
 *                 .and()
 *                 .csrf()
 *                 .disable()
 *                 .cors();
 *         return httpSecurity.build();
 *     }
 * }
 */